<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.42">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
    p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
    p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
    span.s1 {color: #000000}
    span.s2 {color: #007300}
    span.s3 {color: #0000bf}
    span.s4 {color: #bf0000}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1"><b>MonoGrainBF<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>granulates real-time input with Ambisonic panning</b></p>
<p class="p2"><br></p>
<p class="p3"><b>MonoGrainBF.ar(in, winsize, grainrate, winrandpct, azimuth, azrand, elevation, elrand, rho, mul, add)</b></p>
<p class="p2"><br></p>
<p class="p3"><span class="Apple-tab-span">	</span><b>in - </b>a mono input</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>winsize - </b>the window size in seconds</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>grainrate - </b>the rate of which new grains are created (in Hz)</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>winrandpct - </b>a randomness factor for window size (as a percentage of the winsize)</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>azimuth - </b>in radians, -pi to pi</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>azrand - </b>percentage of deviation from the azimuth</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>elevation - </b>in radians, -0.5pi to 0.5pi</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>elrand - </b>percentage of deviation from the elevation</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>rho - </b>the speaker radius.<span class="Apple-converted-space">  </span>(1 places shound at the radius, &lt;1 within the radius, &gt;1 is outside the radius)</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>beyond the radius, this mostly acts as an amplitude scaler (no filtering is done).</p>
<p class="p2"><b></b><br></p>
<p class="p3"><b>Examples:</b></p>
<p class="p2"><b></b><br></p>
<p class="p4">s.boot;</p>
<p class="p5"><br></p>
<p class="p4">(</p>
<p class="p6"><span class="s1">s.sendMsg(</span><span class="s2">\b_allocRead</span><span class="s1">, 0, </span>"sounds/a11wlk01-44_1.aiff"<span class="s1">, 0, -1);</span></p>
<p class="p5"><br></p>
<p class="p4"><span class="s3">SynthDef</span>(<span class="s2">\monograinbf</span>, {<span class="s3">arg</span> buffer = 0;</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s3">var</span> w, x, y, z, out, winsize, grainrate, azimuth, azrand;</p>
<p class="p4"><span class="Apple-tab-span">	</span>winsize = 0.04;</p>
<p class="p4"><span class="Apple-tab-span">	</span>grainrate = 100;</p>
<p class="p4"><span class="Apple-tab-span">	</span>azimuth = <span class="s3">MouseX</span>.kr(-pi, pi); <span class="s4">// move around the radius</span></p>
<p class="p7"><span class="s1"><span class="Apple-tab-span">	</span>azrand = </span><span class="s3">MouseY</span><span class="s1">.kr(0, 1); </span>// 0 = no randomness, 1 = totally random</p>
<p class="p4"><span class="Apple-tab-span">	</span>#w, x, y, z = <span class="s3">MonoGrainBF</span>.ar(<span class="s3">PlayBuf</span>.ar(1, buffer, loop: 1), winsize, grainrate, 0, azimuth, <span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>azrand);</p>
<p class="p4"><span class="Apple-tab-span">	</span>out = <span class="s3">DecodeB2</span>.ar(2, w, x, y, 0.5);</p>
<p class="p4"><span class="Apple-tab-span">	</span><span class="s3">Out</span>.ar(0, out);</p>
<p class="p4">}).send(s);</p>
<p class="p5"><br></p>
<p class="p4">)</p>
<p class="p5"><br></p>
<p class="p5"><br></p>
<p class="p4">s.sendMsg(<span class="s2">\s_new</span>, <span class="s2">\monograinbf</span>, 1000, 0, 0, <span class="s2">\buffer</span>, 0);</p>
<p class="p5"><br></p>
<p class="p4">s.sendMsg(<span class="s2">\n_free</span>, 1000);</p>
<p class="p4">s.sendMsg(\b_free, 0);</p>
</body>
</html>
